
/**
 * Created by wangjiakun on 2018/3/15 0015.
 */
import React from 'react';
import {connect} from 'react-redux';

import { messages, getApprovelHistory, queryCurrencyPrecision, currencyPrecisionCal } from 'share/common';
import {Row, Col, Button, Collapse, Form,InputNumber , Spin,Input, message, Modal, Icon, DatePicker} from 'antd';
const Panel = Collapse.Panel;
const FormItem = Form.Item;
const TextArea = Input.TextArea;

import TravelPlane from 'containers/request/travel-request/travel-slide/travel-plane';
import TravelTrain from 'containers/request/travel-request/travel-slide/travel-train';
import TravelDiDi from 'containers/request/travel-request/travel-slide/travel-didi';
import TravelDining from 'containers/request/travel-request/travel-slide/travel-dining';
import TravelSubsidy from 'containers/request/travel-request/travel-slide/travel-subsidy';
import TravelRemark from 'containers/request/travel-request/travel-slide/travel-remark';
import TravelOther from 'containers/request/travel-request/travel-slide/travel-other';
import TravelHotel from 'containers/request/travel-request/travel-slide/travel-hotel';
import TravelCusHotel from 'containers/request/travel-request/travel-slide/travel-cus-hotel';
import TravelAirline from 'containers/request/travel-request/travel-slide/travel-airline';
import TravelUrban from 'containers/request/travel-request/travel-slide/travel-urban';
import TravelWater from 'containers/request/travel-request/travel-slide/travel-water';
import TravelOut from 'containers/request/travel-request/travel-slide/travel-out';
import SlideFrame from 'components/slide-frame';
import BookConsumptionFrame from 'containers/third-consumption/consumption-book/book-consumption-frame';
import thirdConsumptionService from 'containers/third-consumption/third-consumption.service'

import 'styles/request/travel-request/travel-type.scss'
import travelService from 'containers/request/travel-request/travel.service'
import travelUtil from 'containers/request/travel-request/travelUtil'
import travelRender from 'containers/request/travel-request/travel-itinerary-render'
import baseService from 'share/base.service' ;
import moment from 'moment' ;
import config from 'config';

class TravelType extends React.Component {
  profile = {};
  changedNotSave = false;//修改了表单头部导致清空差补却未保存表单
  saveLock = false;//保存，提交，更新锁，防连续点击。
  constructor(props) {
    super(props);
    this.state = {
      isShowPlaneSlide: false,
      isShowTrainSlide: false,
      isShowDiDiSlide: false,
      isShowDiningSlide: false,
      isShowSubsidySlide: false,
      isShowRemarkSlide: false,
      isShowOtherSlide: false,
      isShowHotelSlide: false,
      isShowCusHotelSlide: false,
      isShowAirlineSlide: false,
      isShowUrbanSlide: false,
      isShowWaterSlide: false,
      isShowOutSlide: false,
      setInfo: {},
      itinerary: [],
      subsidyCopy: [],//差补数据的复制，用来批量更改时提交所用。
      startDate:"",
      subsidyItem:{},//单项修改差补明细的项
      isCanChangeRate:false,//是否能修改汇率
      isChangeVersion:false,//是否是修改版本（已通过又更改操作的单子）
      amountProfile:1001,//金额是否可修改配置 1001 不可修改  1002 可修改不可大于原金额 1003 可修改可大于原金额
      subCtrlObj:{//控制差补行程中的各种标记量
        isBatch:false,//是否批量更改
        isCanMore:false,//是否修改金额可以大于原金额。
        isSaveChange:false,//是否在保存批量更改。
        isEditSubsidyItem:false,//控制是否弹框修改某一项差补明细
      },
      autoSubsidyVisible: false, //自动差补的提示弹框
      autoSubsidyLoading: false,
      isShowTip:false,//是否显示说明差补说明图标
      tipContent:"",//说明内容
      showConsumptionFrame: false,
      zxFlag: '', //机票还是酒店
      debounceSlideFrame: false, //侧滑框防抖，解决快速关闭侧滑框的情况
      airUrl: '', //甄选机票：首页链接
      hotelUrl: '', //甄选酒店：首页链接
      url: '', // iFrame的url
      otherShow: false, //新的其他行程是否展开
    }
  }

  componentWillMount() {
    let start = travelUtil.getFormHeadValue(this.props.setInfo.defaultValue,'start_date');
    let isShowTip = false;
    let tipContent = "";
    let isSetTipes = this.props.setInfo['travelInfo']['customFormPropertyMap']['travel.subsidies.dimension'] ? JSON.parse(this.props.setInfo['travelInfo']['customFormPropertyMap']['travel.subsidies.dimension']) : false;
    if(isSetTipes){
      if(isSetTipes.withTips && isSetTipes.tips){
        //显示tip  true
        isShowTip = true;
        //内容：isSetTipes.tips
        tipContent = isSetTipes.tips;
      }
    }
    this.setState({
      setInfo: this.props.setInfo,
      startDate:start,
      isChangeVersion:this.props.infoDetail['sourceApplicationOID'] ? true : false,
      isShowTip:isShowTip,
      tipContent:tipContent
    });
    this.initItinerary();
    baseService.getProfile().then(res=> {
      this.profile = res.data;
      this.setState({
        isCanChangeRate:res.data['web.expense.rate.edit.disabled'],
        amountProfile:res.data['allowance.amount.modify']

      });
    });

    const {infoDetail: {formCode}} = this.props;
    if(formCode === 'MCD1001' || formCode === 'MCD4001') {
      this.getZhenxuanUrl();
    }
  }

  componentDidMount() {
    if (window.addEventListener) {
      window.addEventListener('message', this.onFrameClose, false);
    } else {
      window.attachEvent('message', this.onFrameClose);
    }
    // window.onmessage = function(message){
    //   this.onFrameClose(message)
    // }
  }

  componentWillUnmount() {
    if (window.addEventListener) {
      window.removeEventListener('message', this.onFrameClose, false);
    } else {
      window.detachEvent('message', this.onFrameClose);
    }
    // delivery-78339 【交付-麦当劳】二期测试环境：申请单总金额需等于明细费用金额合计
    const {zxFlag} = this.state;
    if(zxFlag) {
      const {infoDetail: {formCode}} = this.props;
      if (formCode === 'MCD1001' || formCode === 'MCD4001') {
        this.refreshItinerary(undefined, zxFlag);
      }
    }
  }

  onFrameClose = (e) => {
    console.log('------onFrameClose----------')
    if (e.data && e.data === 'exitHlyHotelWeb') {
      this.handleCloseExpense();
    }
  };

  getZhenxuanUrl = () => {
    // this.getFakeZhenxuanUrl(); return;

    const { user, company } = this.props;
    thirdConsumptionService.getThirdConsumptionList(user.employeeID, company.companyOID).then(res => {
      const list = res.data;
      list.map((ven) => {
        ven.venItems.map(item => {
          const {loginUrl} = item;
          thirdConsumptionService.thirdConsumptionLogin(loginUrl).then((res) => {
            const resUrl = res.data.url;
            if (resUrl.indexOf('vendorCode=airPlane') > -1) { //甄选机票PC链接
              this.setState({
                airUrl: resUrl
              });
            } else if (resUrl.indexOf('vendorCode=hotel') > -1) { //甄选酒店PC链接
              this.setState({
                hotelUrl: resUrl
              });
            }
          }).catch(e => {
            // this.getFakeZhenxuanUrl();
          });
        });
      });
    }).catch(e => {
      // this.getFakeZhenxuanUrl();
    });
  };

  getFakeZhenxuanUrl = () => {
    const zxHost = config.zxHosts[location.host] || config.zxHost;
    this.setState({
      airUrl: `${zxHost}?vendorCode=airPlane`,
      hotelUrl: `${zxHost}?vendorCode=hotel`
    });
  };

  // 甄选机票+甄选酒店：单独用iFrame打开甄选首页
  chooseZhenXuan = (url, flag) => {
    // 这里分两次：先渲染再弹出
    this.setState({ url }, () => { // url决定是否渲染包含iFrame的slide
      this.setState({ showConsumptionFrame: true, zxFlag: flag }); // showConsumptionFrame决定是否弹出slide
    });
  };

  // 关闭slide frame时，重新获取行程接口
  handleCloseExpense = () => {
    const {zxFlag} = this.state;
    const {infoDetail: {formCode}} = this.props;
    this.setState({showConsumptionFrame: false, url:'', zxFlag: ''}, () => {
      if (formCode === 'MCD1001' || formCode === 'MCD4001') {
        this.refreshItinerary(undefined, zxFlag);
      }
    });
  };

  //初始化行程数据
  initItinerary = () => {
    const { setInfo } = this.props;
    const { travelInfo, clearSubsidy, isFirstSave} = setInfo;
    let customFormPropertyMap = travelInfo['customFormPropertyMap'];
    let applicationAutoSubsidy = customFormPropertyMap['travel.subsidies.dimension'] ? JSON.parse(customFormPropertyMap['travel.subsidies.dimension']).applicationAutoSubsidy : false;
    if (clearSubsidy || isFirstSave) {
      //如果有过清空差补操作，判断表单对应差补规则开启了“申请单自动差补”配置 && 表单开启差补行程
      if (applicationAutoSubsidy && customFormPropertyMap['travel.allowance.disabled'] !== 'true') {
        this.setState({autoSubsidyVisible: true});
        this.doAutoSubsidy();
      } else {
        this.refreshItinerary();
      }
    } else {
      this.refreshItinerary();
    }
  };

  closeAutoSubsidyModal = () => {
    this.setState({autoSubsidyVisible: false});
    this.refreshItinerary();
  };

  //自动差补
  doAutoSubsidy = () => {
    const { oid } = this.props.setInfo;
    // this.setState({autoSubsidyLoading: true});
    //调接口自动生成差补，然后刷新预算明细
    travelService.autoSubsidy(oid).then(res => {
      if (res.status === 200) {
        message.success(messages('request.key613')/*已自动生成差补*/);
        this.refreshItinerary(undefined, 'subsidy', true);
        // this.setState({autoSubsidyVisible: false}, () => {
        //   this.setState({autoSubsidyLoading: false}); //task#41070：前端确认按钮导致重复差补问题
        // });
      } else {
        message.error(messages('request.key190'/*操作失败:*/));
      }
    });
  };

  hideSubsidyModal = () => {
    this.setState({autoSubsidyVisible: false});
  };

  componentWillReceiveProps(nextProps){
    //原本行程和表头编辑是同时显示的，所以清空差补的时候不会componentWillMount，需要在componentWillReceiveProps刷新行程数据
    //现在行程和表头数据编辑分离了，保存或取消表头后，会重新加载travel-type组件，componentWillMount已有行程数据刷新逻辑
    //下面三行的逻辑其实现在是走不到的，注释掉了
    // if(nextProps.setInfo.clearSubsidy){//清空差补要重新加载行程
    //   this.refreshItinerary();
    // }
  }

  setClose = () => {
    this.setState({
      isShowTrainSlide: false,
      isShowPlaneSlide: false,
      isShowDiDiSlide: false,
      isShowDiningSlide: false,
      isShowSubsidySlide: false,
      isShowRemarkSlide: false,
      isShowOtherSlide: false,
      isShowHotelSlide: false,
      isShowCusHotelSlide: false,
      isShowAirlineSlide: false,
      isShowUrbanSlide: false,
      isShowWaterSlide: false,
      isShowOutSlide: false,
    })
  }

  /**
   * 打开侧滑
   * @param flag 标记打开哪一个侧滑
   * @param outItem 打开外部行程时标记是哪一个外部行程
   */
  showBaseSlide = (flag, outItem) => {
    const {infoDetail: {formCode}} = this.props;
    switch (flag) {
      case 'plane':
        if(formCode === 'MCD1001' || formCode === 'MCD4001') {
          const {airUrl} = this.state;
          this.chooseZhenXuan(airUrl, flag);
        } else {
          this.setState({isShowPlaneSlide: true, setInfo: this.props.setInfo});
        }
        break;
      case 'train':
        this.setState({isShowTrainSlide: true, setInfo: this.props.setInfo});
        break;
      case 'didi':
        this.setState({isShowDiDiSlide: true, setInfo: this.props.setInfo});
        break;
      case 'dining':
        this.setState({isShowDiningSlide: true, setInfo: this.props.setInfo});
        break;
      case 'subsidy':
        if(this.changedNotSave){
          Modal.confirm({
            title: messages('request.key173'/*提示*/),
            content: messages('request.key408'/*添加差补将自动保存当前单据?*/),
            onOk:()=>{
                this.props.beforeAddSubsidyToSave(true);
                this.changedNotSave = false;
            },
            onCancel:()=>{},
          });
        }else{
          let setInfo = this.props.setInfo;
          setInfo.isOpenSlide = true;
          this.setState({setInfo: setInfo,isShowSubsidySlide: true});
        }
        break;
      case 'remark':
        this.setState({isShowRemarkSlide: true, setInfo: this.props.setInfo});
        break;
      case 'other':
        this.setState({isShowOtherSlide: true, setInfo: this.props.setInfo});
        break;
      case 'hotel':
        if(formCode === 'MCD1001' || formCode === 'MCD4001') {
          const {hotelUrl} = this.state;
          this.chooseZhenXuan(hotelUrl, flag);
        } else {
          this.setState({isShowHotelSlide: true, setInfo: this.props.setInfo});
        }
        break;
      case 'offlinehotel':
        this.setState({isShowCusHotelSlide: true, setInfo: this.props.setInfo});
        break;
      case 'airline':
        this.setState({isShowAirlineSlide: true, setInfo: this.props.setInfo});
        break;
      case 'urban':
        this.setState({isShowUrbanSlide: true, setInfo: this.props.setInfo});
        break;
      case 'water':
        this.setState({isShowWaterSlide: true, setInfo: this.props.setInfo});
        break;
      case 'out':
        let setInfo = this.props.setInfo;
        setInfo.isOpenOutSlide = true;
        setInfo.outItem = outItem;
        setInfo.callBack = this.afterBaseCloseSlide;
        this.setState({isShowOutSlide: true, setInfo: setInfo});
        break;
      default:
        this.setClose();
    }
  }

  /**
   * TODO
   * @param params
   * @param flag
   */
  afterBaseCloseSlide = (params, flag) => {
    if (flag !== 'out') {
      this.refreshItinerary(undefined, flag);
    } else {
      //外部行程关闭后会进行回调，回调完成后会再调一次关闭来刷新行程
      if (params && params.refresh) {
        this.refreshItinerary(undefined, flag);
        return;
      }
    }
    let info = this.state.setInfo;
    switch (flag) {
      case 'plane':
        info.isResetPlane = true;
        this.setState({isShowPlaneSlide: false, setInfo:info});
        break;
      case 'train':
        info.isResetTrain = true;
        this.setState({isShowTrainSlide: false, setInfo:info});
        break;
      case 'didi':
        this.setState({isShowDiDiSlide: false, setInfo:info});
        break;
      case 'dining':
        info.isResetDining = true;
        this.setState({isShowDiningSlide: false, setInfo:info});
        break;
      case 'subsidy':
        info.isResetSubsidy = true;
        info.isOpenSlide = false;
        this.setState({isShowSubsidySlide: false, setInfo:info});
        break;
      case 'remark':
        info.isResetRemark = true;
        this.setState({isShowRemarkSlide: false, setInfo:info});
        break;
      case 'other':
        info.isResetOther = true;
        this.setState({isShowOtherSlide: false, setInfo:info});
        break;
      case 'hotel':
        info.isResetHotel = true;
        this.setState({isShowHotelSlide: false, setInfo:info});
        break;
      case 'offlinehotel':
        info.isResetCusHotel = true;
        this.setState({isShowCusHotelSlide: false, setInfo:info});
        break;
      case 'airline':
        info.isResetAirline = true;
        this.setState({isShowAirlineSlide: false, setInfo:info});
        break;
      case 'urban':
        info.isResetUrban = true;
        this.setState({isShowUrbanSlide: false, setInfo:info});
        break;
      case 'water':
        info.isResetWater = true;
        this.setState({isShowWaterSlide: false, setInfo:info});
        break;
      case 'out':
        info.isOpenOutSlide = false;
        this.setState({isShowOutSlide: false, setInfo:info});
        break;
      default:
        this.setClose;
    }
  }

  //刷新行程记录
  //type 用来标记这次是因为操作了什么行程而更新行程 plane train hotel subsidy
  //didAutoSubsidy 是否已经生成了差补
  refreshItinerary = (display, type, didAutoSubsidy) => {
    let isRefreshBudget = ['plane', 'train', 'hotel', 'offlinehotel', 'airline', 'urban', 'water', 'subsidy'].indexOf(type) > -1;
    travelService.getItinerary(this.props.setInfo.oid).then(res=> {
      this.saveLock = false;
      if(res.data['SUBSIDIES'] && res.data['SUBSIDIES'].length>0){
        let sub = res.data['SUBSIDIES'];
        let total = 0;
        let isRepeat = false;
        sub.map((a,index)=>{
          a.isBatch = false;
          total = total+a.totalBaseCurrencyAmount;
          if(a.travelSubsidiesRequestItemDTOs){
            a.travelSubsidiesRequestItemDTOs.map(b=>{
              if(display && index === display.index && b === display.reqIndex){
                b.isDisplay = true;
              }else if(display && index === display.index){
                b.isDisplay = true;
              }else{
                b.isDisplay = false;
              }
              //wjk add 20180725  判断是否有差补明细重复
              if(b.duplicateSubsidiesOIDs && b.duplicateSubsidiesOIDs.length > 0){
                isRepeat = true;
              }
            })
          }else{
            //这个删除逻辑有问题sub splice后sub已经改变了，第二次执行splice的时候index就不准了
            //app差补明细都删除了后，行程还是展示的，和app逻辑一致
            //sub.splice(index,1);
          }
        });
        this.props.updateTotalBudget(total,false,true,isRepeat, res.data, isRefreshBudget);
      }else if((res.data['FLIGHT'] && res.data['FLIGHT'].length > 0) || (res.data['TRAIN'] && res.data['TRAIN'].length > 0)
        || (res.data['DIDI'] && res.data['DIDI'].length > 0)
        || (res.data['DINING'] && res.data['DINING'].length > 0)
        || (res.data['AUTO_FLIGHT'] && res.data['AUTO_FLIGHT'].length > 0)
        || (res.data['HOTEL'] && res.data['HOTEL'].length > 0)
        || (res.data['OFFLINE_HOTEL'] && res.data['OFFLINE_HOTEL'].length > 0)
        || (res.data['NO_TMC_AIRLINE'] && res.data['NO_TMC_AIRLINE'].length > 0)
        || (res.data['URBAN_TRAFFIC'] && res.data['URBAN_TRAFFIC'].length > 0)
        || (res.data['WATER_TRAFFIC'] && res.data['WATER_TRAFFIC'].length > 0)
        || (res.data['OTHER'] && res.data['OTHER'].length > 0)){
        this.props.updateTotalBudget(0,false,true, null, res.data, isRefreshBudget);
      }else if( res.data['REMARK'] && res.data['REMARK'].length > 0){
        this.props.updateTotalBudget(0,false,true, null, res.data, isRefreshBudget);
      } else{
        this.props.updateTotalBudget(0,false,false, null, res.data, isRefreshBudget);
      }
      this.setState({
        itinerary: res.data,
        subsidyCopy:res.data['SUBSIDIES'] && res.data['SUBSIDIES'].length>0?res.data['SUBSIDIES']:[],
       }, () => {
        //更改参与人（无差补人员变为有差补人员）时，保证自动生成差补
        const {setInfo, isSaveBtnClicked} = this.props;
        const {travelInfo: {customFormPropertyMap}, clearSubsidy, isFirstSave} = setInfo;
        let dimension = customFormPropertyMap['travel.subsidies.dimension'];
        let applicationAutoSubsidy = dimension ? JSON.parse(dimension).applicationAutoSubsidy : false;
        if (!didAutoSubsidy && this.state.subsidyCopy.length == 0 && !clearSubsidy && !isFirstSave && applicationAutoSubsidy &&
          customFormPropertyMap['travel.allowance.disabled'] !== 'true' && isSaveBtnClicked) {
          this.setState({autoSubsidyVisible: true});
          this.doAutoSubsidy();
        }
      });
      let setInfo = this.state.setInfo;
      if(res.data['HOTEL']){
        setInfo.hotel = res.data['HOTEL'];
      }else{
        setInfo.hotel = [];
      }
      if(res.data['OFFLINE_HOTEL']){
        setInfo.offlinehotel = res.data['OFFLINE_HOTEL'];
      }else{
        setInfo.offlinehotel = [];
      }
      if(res.data['NO_TMC_AIRLINE']){
        setInfo.airline = res.data['NO_TMC_AIRLINE'];
      }else{
        setInfo.airline = [];
      }
      if(res.data['URBAN_TRAFFIC']){
        setInfo.urban = res.data['URBAN_TRAFFIC'];
      }else{
        setInfo.urban = [];
      }
      if(res.data['WATER_TRAFFIC']){
        setInfo.water = res.data['WATER_TRAFFIC'];
      }else{
        setInfo.water = [];
      }
      this.setState({setInfo:setInfo});
    }).catch(err =>{
      this.saveLock = false;//接口报错也要解锁
      // message.error(messages('request.key190'/*操作失败:*/) + err.response.data.message);
    })
  }

  /**
   *行程行点击回调打开对应侧滑
   * @param item 被点击行的数据对象
   * @param title 被点击行的折叠板标题
   */
  toEditRecord = (item, title) => {
    if(item.loading){
      return;
    };
    let info = this.state.setInfo;
    if(item.isExtend){//是否为原行程，原行程不可修改
      message.error(messages('request.key315'/*原行程不可修改*/));
      return;
    }
    if (item.isOut) {
      title = 'out';
    }
    switch (title) {
      case 'auto_flight':
      case messages('setting.key1855'/*TMC机票*/):
        info.editPlane = item;
        this.setState({setInfo: info, isShowPlaneSlide: true});
        break;
      case messages('request.key410'/*火车*/):
        info.editTrain = item;
        this.setState({setInfo: info, isShowTrainSlide: true});
        break;
      case messages('request.key411'/*备注*/):
        info.editRemark = item;
        this.setState({setInfo: info, isShowRemarkSlide: true});
        break;
      case messages('request.key412'/*其他*/):
        info.editOther = item;
        this.setState({setInfo: info, isShowOtherSlide: true});
        break;
      case messages('request.key413'/*差补*/):
        info.editSubsidy = item;
        this.setState({setInfo: info, isShowSubsidySlide: true});
        break;
      case messages('mcd.tmc.hotel'/*TMC酒店*/):
        info.editHotel = item;
        this.setState({setInfo: info, isShowHotelSlide: true});
        break;
      case messages('mcd.cus.hotel'/*非TMC酒店*/):
        info.editCusHotel = item;
        this.setState({setInfo: info, isShowCusHotelSlide: true});
        break;
      case messages('mcd.cus.airline'/*非TMC机票*/):
        info.editAirline = item;
        this.setState({setInfo: info, isShowAirlineSlide: true});
        break;
      case messages('mcd.cus.city.traffic'/*市内交通*/):
        info.editUrban = item;
        this.setState({setInfo: info, isShowUrbanSlide: true});
        break;
      case messages('mcd.cus.amphibious'/*水陆客运*/):
        info.editWater = item;
        this.setState({setInfo: info, isShowWaterSlide: true});
        break;
      case 'out':
        info.isOpenOutSlide = true;
        info.editOut = item;
        this.setState({setInfo: info, isShowOutSlide: true});
        break;
      case 'didi':
        info.editDidi = item;
        this.setState({setInfo: info, isShowDiDiSlide: true});
        break;
      case 'dining':
        info.editDining = item;
        this.setState({setInfo: info, isShowDiningSlide: true});
        break;
      default:
        break;
    }
  }

  /**
   * 删除行程行
   * @param item 行程行对象
   * @param title 行程行折叠板标题
   */
  updateTravel = (item, title, index) => {
    let fromCity = item.fromCity;
    let fromCityCode = item.fromCityCode;
    item.fromCity = item.toCity;
    item.fromCityCode = item.toCityCode;
    item.toCity = fromCity;
    item.toCityCode = fromCityCode;
    item.startDate = item.endDate;
    item.endDate = null;
    item.itineraryType = 1001;
    let itinerary = this.state.itinerary;
    switch (title) {
      case messages('setting.key1855'/*TMC机票*/):
        itinerary['FLIGHT'][index].loading = true;
        travelService.updatePlane(item).then(res=> {
          this.refreshItinerary(undefined, 'plane');
          message.success(messages('request.key415'/*已删除*/));
        }).catch(err=>{
          message.error(err.response.data.message);
        });
        break;
      case messages('request.key412'/*其他*/):
        itinerary['OTHER'][index].loading = true;
        travelService.updateOther(item).then(res=> {
          this.refreshItinerary();
          message.success(messages('request.key415'/*已删除*/));
        }).catch(err=>{
          message.error(err.response.data.message);
        });
        break;
      default:
        break;
    }
    this.setState({itinerary:itinerary});
  }

  /**
   * 删除行程行
   * @param item 行程行对象
   * @param title 行程行折叠板标题
   */
  deleteTravel = (item, title, index) => {
    let itinerary = this.state.itinerary;
    switch (title) {
      case messages('setting.key1855'/*TMC机票*/):
        itinerary['FLIGHT'][index].loading = true;
        let pro;
        if (item.meiyaFlightOrderDetails && item.meiyaFlightOrderDetails.length) {
          pro = travelService.deleteZxPlane(item.approvalNum);
        } else {
          pro = travelService.deletePlane(item.flightItineraryOID);
        }
        pro.then(res=> {
          if (res.data.success === false) {
            message.error(res.data.message); return;
          }
          this.refreshItinerary(undefined, 'plane');
          message.success(messages('request.key415'/*已删除*/));
        }).catch(err=>{
          message.error(err.response.data.message);
        });
        break;
      case messages('request.key410'/*火车*/):
        itinerary['TRAIN'][index].loading = true;
        travelService.deleteTrain(item.trainItineraryOID).then(res=> {
          this.refreshItinerary(undefined, 'train');
          message.success(messages('request.key415'/*已删除*/));
        }).catch(err=>{
          message.error(err.response.data.message);
        });
        break;
      case messages('request.key411'/*备注*/):
        itinerary['REMARK'][index].loading = true;
        travelService.deleteRemark(item.itineraryRemarkOID).then(res=> {
          this.refreshItinerary();
          message.success(messages('request.key415'/*已删除*/));
        }).catch(err=>{
          message.error(err.response.data.message);
        });
        break;
      case messages('request.key412'/*其他*/):
        itinerary['OTHER'][index].loading = true;
        travelService.deleteOther(item.otherItineraryOID).then(res=> {
          this.refreshItinerary();
          message.success(messages('request.key415'/*已删除*/));
        }).catch(err=>{
          message.error(err.response.data.message);
        });
        break;
      case messages('mcd.tmc.hotel'/*TMC酒店*/):
        itinerary['HOTEL'][index].loading = true;
        let pro1;
        if(item.travelHotelOrderInfoDTOs && item.travelHotelOrderInfoDTOs.length && item.travelHotelOrderInfoDTOs[0].vendorsOrderStatus) {
          pro1 = travelService.deleteZxHotel(item.approvalNumber);
        } else {
          pro1 = travelService.deleteHotel(item.hotelItineraryOID);
        }
        pro1.then(res=> {
          if (res.data.success === false) {
            message.error(res.data.message); return;
          }
          this.refreshItinerary(undefined, 'hotel');
          message.success(messages('request.key415'/*已删除*/));
        }).catch(err=>{
          message.error(err.response.data.message);
        });
        break;
      case messages('mcd.cus.hotel'/*非TMC酒店*/):
        itinerary['OFFLINE_HOTEL'][index].loading = true;
        travelService.deleteCusHotel(item.hotelItineraryOID).then(res=> {
          this.refreshItinerary(undefined, 'offlinehotel');
          message.success(messages('request.key415'/*已删除*/));
        }).catch(err=>{
          message.error(err.response.data.message);
        });
        break;
      case messages('mcd.cus.airline'/*非TMC机票*/):
        itinerary['NO_TMC_AIRLINE'][index].loading = true;
        travelService.deleteAirline(item.itineraryOID).then(res=> {
          this.refreshItinerary(undefined, 'airline');
          message.success(messages('request.key415'/*已删除*/));
        }).catch(err=>{
          message.error(err.response.data.message);
        });
        break;
      case messages('mcd.cus.city.traffic'/*市内交通*/):
        itinerary['URBAN_TRAFFIC'][index].loading = true;
        travelService.deleteUrban(item.itineraryOID).then(res=> {
          this.refreshItinerary(undefined, 'urban');
          message.success(messages('request.key415'/*已删除*/));
        }).catch(err=>{
          message.error(err.response.data.message);
        });
        break;
      case messages('mcd.cus.amphibious'/*水陆客运*/):
        itinerary['WATER_TRAFFIC'][index].loading = true;
        travelService.deleteWater(item.itineraryOID).then(res=> {
          this.refreshItinerary(undefined, 'offlinehotel');
          message.success(messages('request.key415'/*已删除*/));
        }).catch(err=>{
          message.error(err.response.data.message);
        });
        break;
      case messages('request.key413'/*差补*/):
        itinerary['SUBSIDIES'][index].loading = true;
        travelService.deleteSubsidy(item.id).then(res=>{
          this.refreshItinerary(undefined, 'subsidy');
          message.success(messages('request.key415'/*已删除*/));
        }).catch(err=>{
          message.error(err.response.data.message);
        });
        break;
      case 'didi':
        itinerary['DIDI'][index].loading = true;
        travelService.deleteDidi(item.itineraryOID).then(res=>{
          this.refreshItinerary();
          message.success(messages('request.key415'/*已删除*/));
        }).catch(err=>{
          message.error(err.response.data.message);
        });
        break;
      case 'dining':
        itinerary['DINING'][index].loading = true;
        travelService.deleteDining(item.itineraryOID).then(res => {
          this.refreshItinerary();
          message.success(messages('request.key415'/*已删除*/));
        }).catch(err => {
          message.error(err.response.data.message);
        });
        break;
      default:
        break;
    }
    this.setState({itinerary:itinerary});
  }

  //展开差补明细
  displayDetail = (index,reqIndex) =>{
    let tempData = this.state.itinerary['SUBSIDIES'];
    let dis = false;
    if(reqIndex === 0 || reqIndex){
      dis = tempData[index].travelSubsidiesRequestItemDTOs[reqIndex].isDisplay;
      tempData[index].travelSubsidiesRequestItemDTOs[reqIndex].isDisplay = !dis;
    }else {
      tempData[index].travelSubsidiesRequestItemDTOs.map(req => {
        req.isDisplay = true;
      })
    }
    let all = this.state.itinerary;
    all['SUBSIDIES'] = tempData;
    this.setState({itinerary:all});
  }

  //点击批量修改回调函数
  toBatchChange = (index) =>{
    let display = {index:index};
    let tempData = this.state.itinerary;
    let subData = tempData['SUBSIDIES'];
    let obj = this.state.subCtrlObj;
    switch (this.profile['allowance.amount.modify']){
      case 1001:message.error(messages('request.key416'/*不可修改*/));
        break;
      case 1002:subData[index].isBatch = !subData[index].isBatch;
        if(!subData[index].isBatch){
          this.refreshItinerary();
        }else{
          this.displayDetail(index);
        }
        obj.isCanMore = false;
        this.setState({subCtrlObj:obj});
        break;
      case 1003:subData[index].isBatch = !subData[index].isBatch;
        if(!subData[index].isBatch){
          this.refreshItinerary();
        }else{
          this.displayDetail(index);
        }
        obj.isCanMore = true;
        this.setState({subCtrlObj:obj});
        break;
      default:message.error(messages('request.key416'/*不可修改*/));
        break;
    }
  }

  //批量修改是金额动态绑定到复制区subsidyCopy上，提交批量修改时使用。
  amountChange = (index,reqIndex,detIndex,indexOf,e) =>{
    let tempData = this.state.subsidyCopy;
    tempData[index].travelSubsidiesRequestItemDTOs[reqIndex].travelSubsidiesItemMap[detIndex].travelSubsidiesRequestItemDetailDTOs[indexOf].amount =  e;
    this.setState({subsidyCopy:tempData});
  }

  //批量或单项修改保存
  toSaveChange = (index) =>{
    if(this.saveLock){
      return;
    }
    let displayItem = {index:index};
    let isCanCommit = true;
    let saveParams = [];
    let tempData = this.state.subsidyCopy;
    if(index >= 0){//大于等于零属于批量修改，否则为单项修改
      tempData[index].travelSubsidiesRequestItemDTOs.map(req => {
        req.travelSubsidiesItemMap.map(det => {
          det.travelSubsidiesRequestItemDetailDTOs.map(item => {
            saveParams.push(item);
          });
        });
      });
    }else{
      let detailItem = this.state.subsidyItem;
      if(detailItem.currencyRate > 0){
        this.props.form.validateFieldsAndScroll((err,values) => {
          if(values.comment && values.comment.length === 101){
            isCanCommit = false;
            message.error(messages('request.key349'/*备注长度超出*/));
          }
          if(this.state.amountProfile === 1002 && values.amount > detailItem.baseAmount){
            message.error(messages('request.key571')/*金额不可大于原金额*/);
            err = true;
          }
          if(!err){
            values.currencyRate = detailItem.currencyRate;
            detailItem = Object.assign(detailItem,values);
            displayItem = {
              index:detailItem.displayItem.index,
              reqIndex:detailItem.displayItem.reqIndex
            };
            delete detailItem.displayItem;
            delete detailItem.city;
            saveParams.push(detailItem);
          }else{
            isCanCommit = false;
          }
        })
      }else{
        message.error(messages('request.key417'/*汇率必须大于零*/));
        return;
      }
    }
    if(!isCanCommit){
      return;
    }
    this.saveLock = true;
    let subCtrl = this.state.subCtrlObj;
    subCtrl.isSaveChange = true;
    this.setState({subCtrlObj:subCtrl});
    travelService.updateSubsidyDetail(saveParams).then(res=>{
      message.success(messages('request.key353'/*已更新*/));
      subCtrl.isSaveChange = false;
      this.setState({subCtrlObj:subCtrl});
      this.refreshItinerary(displayItem, 'subsidy');//刷新行程记录
      this.cancelEditSubsidyModal();// 关闭弹框
    }).catch(er=>{
      this.saveLock = false;
      this.cancelEditSubsidyModal();// 关闭弹框
      message.error(messages('request.key190'/*操作失败:*/)+er.response.data.message);
      subCtrl.isSaveChange = false;
      this.setState({subCtrlObj:subCtrl});
    })
  }

  //单项修改
  toEditSubsidyItem = (detailItem, cityName, displayItem) =>{
    let obj = this.state.subCtrlObj;
    obj.isEditSubsidyItem = true;
    let detail = {
      "travelSubsidiesDetailsOID":detailItem.travelSubsidiesDetailsOID,
      "applicationOID":detailItem.applicationOID,
      "expenseTypeOID":detailItem.expenseTypeOID,
      "expenseTypeName":detailItem.expenseTypeName,
      "userOID":detailItem.userOID,
      "amount":parseFloat(currencyPrecisionCal(detailItem.currencyCode, detailItem.amount)),
      "currencyCode":detailItem.currencyCode,
      "baseCurrencyAmount":detailItem.baseCurrencyAmount,
      "status":detailItem.status,
      "subsidiesDate":detailItem.subsidiesDate,
      "currencyRate":detailItem.currencyRate,
      "baseCurrencyRate":detailItem.baseCurrencyRate,
      "comment":detailItem.comment,
      "baseAmount":detailItem.baseAmount,
      "lastModifiedDate":detailItem.lastModifiedDate,
      "deleted":detailItem.deleted,
      "areaCode":detailItem.areaCode,
      "travelSubsidiesRequestID":detailItem.travelSubsidiesRequestID,
      "city":cityName,
      "displayItem":{index:displayItem.index,reqIndex:displayItem.reqIndex}
    }
    this.setState({
      subsidyItem:detail,
      subCtrlObj:obj,
    });
  }

  //单项修改时当前汇率变化回调
  currencyRateChange = (value) => {
    const { subsidyItem } = this.state;
    subsidyItem.currencyRate = value.target.value ? parseFloat(value.target.value).toFixed(2) : subsidyItem.currencyRate;
    subsidyItem.currencyRate = parseFloat(subsidyItem.currencyRate);
    this.setState({subsidyItem});
  }

  //取消单项修改
  cancelEditSubsidyModal = () =>{
    let obj = this.state.subCtrlObj;
    obj.isEditSubsidyItem = false;
    this.props.form.resetFields();
    this.setState({ subCtrlObj:obj});
  }

  /**
   * 清空备注行程行备注信息
   * @param res 备注行程行对象
   */
  clearRowRemark = (res, index) => {
    let itinerary = this.state.itinerary;
    itinerary['REMARK'][index].loading = true;
    travelService.clearRemark(res.itineraryRemarkOID).then(data=> {
      this.refreshItinerary();
      message.success(messages('request.key418'/*清空成功*/));
    }).catch(err=>{
      message.error(err.response.data.message);
    });
    this.setState({itinerary:itinerary});
  }

  //根据日期查询差补明细
  searchByDate = (e,index) =>{
    if(!e){
      this.refreshItinerary();
    }else{
      let date = moment(e).format('YYYY-MM-DD');
      let itinerary = this.state.itinerary;
      travelService.getSubsidyDetailByDate(date,itinerary['SUBSIDIES'][index].id).then(res=>{
        itinerary['SUBSIDIES'][index] = res.data;
        this.setState({itinerary:itinerary});
      }).catch(err=>{
        message.error(messages('request.key190'/*操作失败:*/)+err.response.data.message);
      })
    }
  }

  //隐藏 变删除了
  isHiddenItem = (req, isDetail, dispalyItem) =>{
    if(this.saveLock){
      return;
    }
    let params = [];
    if(isDetail){
      req.deleted = true;
      params.push(req);
    }else{
      req.travelSubsidiesItemMap.map(det => {
        det.travelSubsidiesRequestItemDetailDTOs.map(detail => {
          detail.deleted = true;
          params.push(detail);
        })
      })
    }
    this.saveLock = true;//加锁
    travelService.updateSubsidyDetail(params).then(res => {
      this.refreshItinerary(dispalyItem, 'subsidy');//刷新行程记录，并解锁
    }).catch(er => {
      this.saveLock = false;//放开锁
      message.error(messages('request.key190'/*操作失败:*/) + er.response.data.message);
    })
  }

  //取消隐藏
  isCancelHiddenItem = (req,isDetail,dispalyItem) =>{
    if(this.saveLock){
      return;
    }
    let params = [];
    if(isDetail){
      req.status = 1001;
      params.push(req);
    }else{
      req.travelSubsidiesItemMap.map(det=>{
        det.travelSubsidiesRequestItemDetailDTOs.map(detail=>{
          detail.status = 1001;
          params.push(detail);
        })
      });
    }
    this.saveLock = true;//加锁
    travelService.updateSubsidyDetail(params).then(res=>{
      this.refreshItinerary(dispalyItem);//刷新行程记录，并解锁
    }).catch(er=>{
      this.saveLock = false;//解锁
      message.error(messages('request.key190'/*操作失败:*/)+er.response.data.message);
    })
  }

  stopAndStart = (e, item, title, index) => {
    const { travelInfo } = this.props.setInfo;
    e.stopPropagation();
    let itinerary = this.state.itinerary;
    let duplicateEnable = travelInfo['customFormPropertyMap']['hotel.repetition.control'] === 'true';
    let duplicateEnableOff = travelInfo['customFormPropertyMap']['offline.hotel.repetition.control'] === 'true';
    //这里竟然用名字判断，有空优化下
    if (title === messages('mcd.tmc.hotel'/*TMC酒店*/) && !duplicateEnable) {
      let errorMsg = travelUtil.checkHotelDateIsOk(itinerary['HOTEL'], item);
      if (errorMsg) {
        message.error(errorMsg);
        return;
      }
    }
    // if (title === messages('mcd.cus.hotel'/*非TMC酒店*/) && !duplicateEnableOff) {
    //   let errMsg = travelUtil.checkHotelDateIsOk(itinerary['OFFLINE_HOTEL'], item);
    //   if (errMsg) {
    //     message.error(errMsg);
    //     return;
    //   }
    // }

    switch (title){
      case messages('setting.key1855'/*TMC机票*/):
        itinerary['FLIGHT'][index].loading = true;
        travelService.stopPlane(!item.disabled, item.flightItineraryOID).then(res => {
          //'恢复成功' : '停用成功'
          message.success(!item.disabled ? messages('request.key419'/*停用成功*/) : messages('request.key420'/*恢复成功*/));
          this.refreshItinerary(undefined, 'plane');
        }).catch(err => {
          message.error(err.response.data.message);
        });
            break;
      case 'auto_flight':
        itinerary['AUTO_FLIGHT'][index].loading = true;
        travelService.stopPlane(!item.disabled, item.flightItineraryOID).then(res => {
          //'恢复成功' : '停用成功'
          message.success(!item.disabled ? messages('request.key419'/*停用成功*/) : messages('request.key420'/*恢复成功*/));
          this.refreshItinerary(undefined, 'plane');
        }).catch(err => {
          message.error(err.response.data.message);
        });
        break;
      case messages('request.key412'/*其他*/):
        itinerary['OTHER'][index].loading = true;
        travelService.stopOther(!item.disabled, item.otherItineraryOID).then(res => {
          this.refreshItinerary();
          message.success(!item.disabled ? messages('request.key419'/*停用成功*/) : messages('request.key420'/*恢复成功*/));
        }).catch(err => {
          message.error(err.response.data.message);
        });
        break;
      case messages('request.key410'/*火车*/):
        itinerary['TRAIN'][index].loading = true;
        travelService.stopTrain(!item.disabled, item.trainItineraryOID).then(res => {
          this.refreshItinerary(undefined, 'train');
          message.success(!item.disabled ? messages('request.key419'/*停用成功*/) : messages('request.key420'/*恢复成功*/));
        }).catch(err => {
          message.error(err.response.data.message);
        });
        break;
      case messages('mcd.tmc.hotel'/*TMC酒店*/):
        itinerary['HOTEL'][index].loading = true;
        travelService.stopHotel(!item.disabled, item.hotelItineraryOID).then(res => {
          this.refreshItinerary(undefined, 'hotel');
          message.success(!item.disabled ? messages('request.key419'/*停用成功*/) : messages('request.key420'/*恢复成功*/));
        }).catch(err => {
          message.error(err.response.data.message);
        });
        break;
      case messages('mcd.cus.hotel'/*非TMC酒店*/):
        itinerary['OFFLINE_HOTEL'][index].loading = true;
        travelService.stopOfflineHotel(!item.disabled, item.hotelItineraryOID).then(res => {
          this.refreshItinerary(undefined, 'offlinehotel');
          message.success(!item.disabled ? messages('request.key419'/*停用成功*/) : messages('request.key420'/*恢复成功*/));
        }).catch(err => {
          message.error(err.response.data.message);
        });
        break;
      case 'didi':
        itinerary['DIDI'][index].loading = true;
        travelService.stopDiDi(!item.disabled, item.itineraryOID).then(res => {
          this.refreshItinerary();
          message.success(!item.disabled ? messages('request.key419'/*停用成功*/) : messages('request.key420'/*恢复成功*/));
        }).catch(err => {
          message.error(err.response.data.message);
        });
        break;
      case 'dining':
        itinerary['DINING'][index].loading = true;
        travelService.stopDining(!item.disabled, item.itineraryOID).then(res => {
          this.refreshItinerary();
          message.success(!item.disabled ? messages('request.key419'/*停用成功*/) : messages('request.key420'/*恢复成功*/));
        }).catch(err => {
          message.error(err.response.data.message);
        });
        break;
      default:break;
    }
    this.setState({itinerary:itinerary});
  }

  cfo = travelUtil.createFormOption;

  showSubsidyTip = () => {
    Modal.info({
      title: messages('request.key421'/*差补添加说明*/),/*添加差补说明*/
      content:<div style={{maxHeight:'200px',overflow:'auto'}}>
        {this.state.tipContent}
      </div>,
      onOk() {},
    });
  }

  hideAndShow = (key) => {
    let { itinerary } = this.state;
    if (window.ISIE9) {
      itinerary[key].show = !itinerary[key].show;
      this.setState({itinerary});
    }
  };

  hideAndShowOther = () => {
    let { otherShow } = this.state;
    if (window.ISIE9) {
      otherShow = !otherShow;
      this.setState({otherShow});
    }
  };
  /**
   * 校验是否展示行程
   * @param datas 行程数据
   * @param type REMARK
   */
  checkIsShowItinerary = (datas, type) => {
    let isShow = false;
    if (datas.length > 0 && type !== 'REMARK') {
      isShow = true;
    }
    if (datas.length > 0 && type === 'REMARK') {
      datas.map(map => {
        if (map.remark || map.itineraryShowDetails.length > 0)
          isShow = true;
      });
    }
    return isShow;
  };

  render() {
    const { isChangeVersion, itinerary, subCtrlObj,subsidyItem, isCanChangeRate,
      amountProfile, startDate, isShowHotelSlide, isShowCusHotelSlide, isShowTrainSlide, isShowPlaneSlide, isShowDiDiSlide, isShowDiningSlide,
      isShowSubsidySlide, isShowRemarkSlide, isShowOtherSlide, setInfo, isShowTip, tipContent, isShowOutSlide,
      autoSubsidyVisible, autoSubsidyLoading, showConsumptionFrame, debounceSlideFrame, url, hotelUrl, airUrl,
      isShowAirlineSlide, isShowUrbanSlide, isShowWaterSlide, otherShow } = this.state;
    const {infoDetail: {formCode, applicationOID}, company} = this.props;
    const zhenxuanUrl = `${url}&applicationOid=${applicationOID}`;
    const mapInfo = setInfo['travelInfo']['customFormPropertyMap'];
    const flight = itinerary['FLIGHT'] ? itinerary['FLIGHT'] : [];
    const autoFlight = itinerary['AUTO_FLIGHT'] ? itinerary['AUTO_FLIGHT'] : [];
    const train = itinerary['TRAIN'] ? itinerary['TRAIN'] : [];
    const other = itinerary['OTHER'] ? itinerary['OTHER'] : [];
    const remark = itinerary['REMARK'] ? itinerary['REMARK'] : [];
    const hotel = itinerary['HOTEL'] ? itinerary['HOTEL'] : [];
    const offlineHotel = itinerary['OFFLINE_HOTEL'] || [];
    const airline = itinerary['NO_TMC_AIRLINE'] || [];
    const urban = itinerary['URBAN_TRAFFIC'] || [];
    const water = itinerary['WATER_TRAFFIC'] || [];
    const subsidy = itinerary['SUBSIDIES'] || [];
    const didi = itinerary['DIDI'] ? itinerary['DIDI'] : [];
    const dining = itinerary['DINING'] ? itinerary['DINING'] : [];
    const otherItinerarys = [
      ...airline.map((item, idx) => ({...item, itineraryKey: 'airline', itineraryName: messages('mcd.cus.airline'/*非TMC机票*/), idx})),
      ...offlineHotel.map((item, idx) => ({...item, itineraryKey: 'offlineHotel', itineraryName: messages('mcd.cus.hotel'/*非TMC酒店*/), idx})),
      ...urban.map((item, idx) => ({...item, itineraryKey: 'urban', itineraryName: messages('mcd.cus.city.traffic'/*市内交通*/), idx})),
      ...water.map((item, idx) => ({...item, itineraryKey: 'water', itineraryName: messages('mcd.cus.amphibious'/*水陆客运*/), idx})),
      ...subsidy.map((item, idx) => ({...item, itineraryKey: 'subsidy', itineraryName: messages('request.key413'/*差补*/), idx}))
    ];
    const {getFieldDecorator} = this.props.form;
    const formItemLayoutM2 = {
      labelCol: {span: 4},
      wrapperCol: {span: 8}
    };
    const formItemLayoutL = {
      labelCol: {span: 4},
      wrapperCol: {span: 18}
    };
    const formItemLayoutS = {
      labelCol: {span: 8},
      wrapperCol: {span: 12}
    };
    const baseCcy = company.baseCurrency;
    let out_itineraries = mapInfo['out_itineraries'] ? JSON.parse(mapInfo['out_itineraries']) : [];
    return (
      <div className="travel-type-select" style={{width:'90%',paddingBottom:6}}>
        <Row>
          <Col className="travel-type">
            {
              mapInfo['ca.travel.flight.disabled'] !== 'true'
              && <Button className="travel-type-btn" type="dashed" icon="plus" onClick={()=>this.showBaseSlide('plane')}>{messages('setting.key1855'/*TMC机票*/)}</Button>
            }
            {
              mapInfo['hotel.itinerary.enable'] === "true"
              && <Button className="travel-type-btn" onClick={()=>this.showBaseSlide('hotel')} type="dashed" icon="plus">{messages('mcd.tmc.hotel'/*TMC酒店*/)}</Button>
            }
            {
              mapInfo['airline.itinerary.enable'] === "true"
              && <Button className="travel-type-btn" onClick={()=>this.showBaseSlide('airline')} type="dashed" icon="plus">{messages('mcd.cus.airline'/*非TMC机票*/)}</Button>
            }
            {
              mapInfo['offline.hotel.itinerary.enable'] === "true"
              && <Button className="travel-type-btn" onClick={()=>this.showBaseSlide('offlinehotel')} type="dashed" icon="plus">{messages('mcd.cus.hotel'/*非TMC酒店*/)}</Button>
            }
            {
              mapInfo['ca.travel.train.disabled'] !== 'true'
              && <Button className="travel-type-btn" onClick={()=>this.showBaseSlide('train')} type="dashed" icon="plus">{messages('supplier.key474'/*火车*/)}</Button>
            }
            {
              mapInfo['urban.itinerary.enable'] === "true"
              && <Button className="travel-type-btn" onClick={()=>this.showBaseSlide('urban')} type="dashed" icon="plus">{messages('mcd.cus.city.traffic'/*市内交通*/)}</Button>
            }
            {
              mapInfo['water.itinerary.enable'] === "true"
              && <Button className="travel-type-btn" onClick={()=>this.showBaseSlide('water')} type="dashed" icon="plus">{messages('mcd.cus.amphibious'/*水陆客运*/)}</Button>
            }

              {
                mapInfo['didi.itinerary.enable'] === "true" &&
                <Button className="travel-type-btn" onClick={()=>this.showBaseSlide('didi')} type="dashed" icon="plus">{messages('request.key599')/*添加用车行程*/}</Button>
              }
              {
                mapInfo['dining.itinerary.enable'] === "true" &&
                <Button className="travel-type-btn" onClick={()=>this.showBaseSlide('dining')} type="dashed" icon="plus">{messages('request.key638')/*添加用餐*/}</Button>
              }
              {
                /*mapInfo['travel.allowance.disabled'] !== 'true'
                && <Button className="travel-type-btn" onClick={()=>this.showBaseSlide('subsidy')} type="dashed"
                           icon="plus">{messages('request.key423'/!*添加差补*!/)}</Button>*/
              }
              {
                mapInfo['ca.travel.remark.disabled'] !== 'true'
                &&  <Button className="travel-type-btn" onClick={()=>this.showBaseSlide('remark')} type="dashed" icon="plus">{messages('request.key424'/*添加行程备注*/)}</Button>
              }
              {
                mapInfo['ca.travel.other.disabled'] !== 'true'
                &&  <Button className="travel-type-btn" onClick={()=>this.showBaseSlide('other')} type="dashed" icon="plus">{messages('request.key320'/*添加其他交通*/)}</Button>
              }
            {out_itineraries.map(out => {
              if (out.isShow) {
                return (
                  <Button className="travel-type-btn" onClick={()=>this.showBaseSlide('out', out)} type="dashed" icon="plus">{out.name}</Button>
                )
              }
            })}
          </Col>
        </Row>
        {window.ISIE9 && (<Row className="type-collapse-ie9">
          {/*TMC机票*/}
          {this.checkIsShowItinerary(flight) && (
            <div>
              <Row className="itinerary-header-ie9" onClick={() => this.hideAndShow('FLIGHT')}>
                <Col span={1} offset={1}>
                  {flight.show && (<Icon type="down" />)}
                  {!flight.show && (<Icon type="right" />)}
                </Col>
                <Col span={5}>
                  {travelRender.getTravelRecordHeader(messages('setting.key1855'/*TMC机票*/), flight, this.toEditRecord, this.deleteTravel, this.updateTravel, this.stopAndStart, startDate, isChangeVersion)}
                </Col>
              </Row>
              {flight.show && (
                <Row className="type-plane">
                  {travelRender.getTravelRecordContent(messages('setting.key1855'/*TMC机票*/), flight, this.toEditRecord, this.deleteTravel, this.updateTravel, this.stopAndStart, startDate, isChangeVersion, undefined, airUrl)}
                </Row>
              )}
            </div>
          )}

          {/*智能机票*/}
          {this.checkIsShowItinerary(autoFlight) && (
            <div>
              <Row className="itinerary-header-ie9" onClick={() => this.hideAndShow('AUTO_FLIGHT')}>
                <Col span={1} offset={1}>
                  {autoFlight.show && (<Icon type="down" />)}
                  {!autoFlight.show && (<Icon type="right" />)}
                </Col>
                <Col span={5}>
                  {travelRender.getTravelRecordHeader(messages('request.key542')/*智能机票*/, autoFlight, this.toEditRecord, this.deleteTravel, this.updateTravel, this.stopAndStart, startDate, isChangeVersion, 'AUTO_FLIGHT')}
                </Col>
              </Row>
              {autoFlight.show && (
                <Row className="type-plane">
                  {travelRender.getTravelRecordContent(messages('request.key542')/*智能机票*/, autoFlight, this.toEditRecord, this.deleteTravel, this.updateTravel, this.stopAndStart, startDate, isChangeVersion, 'AUTO_FLIGHT')}
                </Row>
              )}
            </div>
          )}

          {/*TMC酒店*/}
          {this.checkIsShowItinerary(hotel) && (
            <div>
              <Row className="itinerary-header-ie9" onClick={() => this.hideAndShow('HOTEL')}>
                <Col span={1} offset={1}>
                  {hotel.show && (<Icon type="down" />)}
                  {!hotel.show && (<Icon type="right" />)}
                </Col>
                <Col span={5}>
                  {travelRender.getHotelRecordHeader(messages('mcd.tmc.hotel'/*TMC酒店*/), hotel, this.toEditRecord, this.deleteTravel, this.stopAndStart, startDate, isChangeVersion)}
                </Col>
              </Row>
              {hotel.show && (
                <Row className="type-plane">
                  {travelRender.getHotelRecordContent(messages('mcd.tmc.hotel'/*TMC酒店*/), hotel, this.toEditRecord, this.deleteTravel, this.stopAndStart, startDate, isChangeVersion, hotelUrl)}
                </Row>
              )}
            </div>
          )}

          {/*火车*/}
          {this.checkIsShowItinerary(train) && (
            <div>
              <Row className="itinerary-header-ie9" onClick={() => this.hideAndShow('TRAIN')}>
                <Col span={1} offset={1}>
                  {train.show && (<Icon type="down" />)}
                  {!train.show && (<Icon type="right" />)}
                </Col>
                <Col span={5}>
                  {travelRender.getTravelRecordHeader(messages('request.key410'/*火车*/), train, this.toEditRecord, this.deleteTravel, '', this.stopAndStart, startDate, isChangeVersion)}
                </Col>
              </Row>
              {train.show && (
                <Row className="type-plane">
                  {travelRender.getTravelRecordContent(messages('request.key410'/*火车*/), train, this.toEditRecord, this.deleteTravel, '', this.stopAndStart, startDate, isChangeVersion)}
                </Row>
              )}
            </div>
          )}

          {/*非TMC酒店*/}
          {false && this.checkIsShowItinerary(offlineHotel) && (
            <div>
              <Row className="itinerary-header-ie9" onClick={() => this.hideAndShow('OFFLINE_HOTEL')}>
                <Col span={1} offset={1}>
                  {offlineHotel.show && (<Icon type="down" />)}
                  {!offlineHotel.show && (<Icon type="right" />)}
                </Col>
                <Col span={5}>
                  {travelRender.getOfflineHotelRecordHeader(messages('mcd.cus.hotel'/*非TMC酒店*/), offlineHotel, this.toEditRecord, this.deleteTravel, this.stopAndStart, startDate, isChangeVersion)}
                </Col>
              </Row>
              {offlineHotel.show && (
                <Row className="type-plane">
                  {travelRender.getOfflineHotelRecordContent(messages('mcd.cus.hotel'/*非TMC酒店*/), offlineHotel, this.toEditRecord, this.deleteTravel, this.stopAndStart, startDate, isChangeVersion)}
                </Row>
              )}
            </div>
          )}

          {/*打车*/}
          {this.checkIsShowItinerary(didi) && (
            <div>
              <Row className="itinerary-header-ie9" onClick={() => this.hideAndShow('DIDI')}>
                <Col span={1} offset={1}>
                  {didi.show && (<Icon type="down" />)}
                  {!didi.show && (<Icon type="right" />)}
                </Col>
                <Col span={5}>
                  {travelRender.getDiDiRecordHeader(messages('request.key481')/*打车*/, didi, startDate, this.deleteTravel, this.toEditRecord, this.stopAndStart, isChangeVersion)}
                </Col>
              </Row>
              {didi.show && (
                <Row className="type-didi">
                  {travelRender.getDiDiRecordContent(messages('request.key481')/*打车*/, didi, startDate, this.deleteTravel, this.toEditRecord, this.stopAndStart, isChangeVersion, mapInfo)}
                </Row>
              )}
            </div>
          )}

          {/*用餐*/}
          {this.checkIsShowItinerary(dining) && (
            <div>
              <Row className="itinerary-header-ie9" onClick={() => this.hideAndShow('DINING')}>
                <Col span={1} offset={1}>
                  {didi.show && (<Icon type="down" />)}
                  {!didi.show && (<Icon type="right" />)}
                </Col>
                <Col span={5}>
                  {travelRender.getDiningRecordHeader(messages('request.key626')/*用餐*/, didi, startDate, this.deleteTravel, this.toEditRecord, this.stopAndStart, isChangeVersion)}
                </Col>
              </Row>
              {didi.show && (
                <Row className="type-didi">
                  {travelRender.getDiningRecordContent(messages('request.key626')/*用餐*/, didi, startDate, this.deleteTravel, this.toEditRecord, this.stopAndStart, isChangeVersion)}
                </Row>
              )}
            </div>
          )}

          {/*差补*/}
          {false && this.checkIsShowItinerary(subsidy) && (
            <div>
              <Row className="itinerary-header-ie9" onClick={() => this.hideAndShow('SUBSIDIES')}>
                <Col span={1} offset={1}>
                  {subsidy.show && (<Icon type="down" />)}
                  {!subsidy.show && (<Icon type="right" />)}
                </Col>
                <Col span={5}>
                  {travelRender.getSubsidyRecordHeader(messages('request.key413'/*差补*/),
                    subsidy,
                    this.toEditRecord,
                    this.deleteTravel,
                    this.displayDetail,
                    this.toBatchChange,
                    this.amountChange,
                    this.toSaveChange,
                    this.toEditSubsidyItem,
                    this.searchByDate,
                    this.isHiddenItem,
                    this.isCancelHiddenItem,
                    subCtrlObj)
                  }
                </Col>
              </Row>
              {subsidy.show && (
                <Row className="type-plane">
                  {travelRender.getSubsidyRecordContent(messages('request.key413'/*差补*/),
                    subsidy,
                    this.toEditRecord,
                    this.deleteTravel,
                    this.displayDetail,
                    this.toBatchChange,
                    this.amountChange,
                    this.toSaveChange,
                    this.toEditSubsidyItem,
                    this.searchByDate,
                    this.isHiddenItem,
                    this.isCancelHiddenItem,
                    subCtrlObj)
                  }
                </Row>
              )}
            </div>
          )}

          {/*备注*/}
          {false && this.checkIsShowItinerary(remark, 'REMARK') && (
            <div>
              <Row className="itinerary-header-ie9" onClick={() => this.hideAndShow('REMARK')}>
                <Col span={1} offset={1}>
                  {remark.show && (<Icon type="down" />)}
                  {!remark.show && (<Icon type="right" />)}
                </Col>
                <Col span={5}>
                  {travelRender.getRemarkRecordHeader(messages('request.key411'/*备注*/), remark, this.toEditRecord, this.deleteTravel, this.clearRowRemark, startDate)}
                </Col>
              </Row>
              {remark.show && (
                <Row className="type-plane">
                  {travelRender.getRemarkRecordContent(messages('request.key411'/*备注*/), remark, this.toEditRecord, this.deleteTravel, this.clearRowRemark, startDate)}
                </Row>
              )}
            </div>
          )}

          {/*其他*/}
          {false && this.checkIsShowItinerary(other) && (
            <div>
              <Row className="itinerary-header-ie9" onClick={() => this.hideAndShow('OTHER')}>
                <Col span={1} offset={1}>
                  {other.show && (<Icon type="down" />)}
                  {!other.show && (<Icon type="right" />)}
                </Col>
                <Col span={5}>
                  {travelRender.getTravelRecordHeader(messages('request.key412'/*其他*/), other, this.toEditRecord, this.deleteTravel, this.updateTravel, this.stopAndStart, startDate, isChangeVersion)}
                </Col>
              </Row>
              {other.show && (
                <Row className="type-plane">
                  {travelRender.getTravelRecordContent(messages('request.key412'/*其他*/), other, this.toEditRecord, this.deleteTravel, this.updateTravel, this.stopAndStart, startDate, isChangeVersion)}
                </Row>
              )}
            </div>
          )}

          {/*行程改造 其他（非TMC机票、非TMC酒店、市内交通、水陆客运、差补）*/}
          {this.checkIsShowItinerary(otherItinerarys) && (
            <div>
              <Row className="itinerary-header-ie9" onClick={() => this.hideAndShowOther()}>
                <Col span={1} offset={1}>
                  {otherShow && (<Icon type="down" />)}
                  {!otherShow && (<Icon type="right" />)}
                </Col>
                <Col span={5}>
                  {travelRender.getTravelRecordHeader(messages('request.key412'/*其他*/), otherItinerarys)}
                </Col>
              </Row>
              {otherShow && (
                <Row className="type-plane">
                  {travelRender.getOtherRecordContent(
                    messages('request.key412'/*其他*/),
                    otherItinerarys,
                    this.toEditRecord,
                    this.deleteTravel,
                    this.updateTravel,
                    this.displayDetail,
                    this.toBatchChange,
                    this.amountChange,
                    this.toSaveChange,
                    this.toEditSubsidyItem,
                    this.searchByDate,
                    this.isHiddenItem,
                    this.isCancelHiddenItem,
                    subCtrlObj,
                    baseCcy)}
                </Row>
              )}
            </div>
          )}
        </Row>)}
        {!window.ISIE9 && <Row>
          <Col>
            <Collapse bordered={false} className="type-collapse">
              { travelUtil.getTravelRecord(messages('setting.key1855'/*TMC机票*/),
                flight,
                this.toEditRecord,
                this.deleteTravel,
                this.updateTravel,
                this.stopAndStart,
                startDate,
                isChangeVersion,
                undefined,
                airUrl
              )}
              { travelUtil.getTravelRecord(messages('request.key542')/*智能机票*/,
                autoFlight,
                this.toEditRecord,
                this.deleteTravel,
                this.updateTravel,
                this.stopAndStart,
                startDate,
                isChangeVersion, 'AUTO_FLIGHT'
              )}
              { travelUtil.getHotelRecord(messages('mcd.tmc.hotel'/*TMC酒店*/), hotel, this.toEditRecord, this.deleteTravel,this.stopAndStart,startDate,isChangeVersion, hotelUrl)}
              { false && travelUtil.getOfflineHotelRecord(messages('mcd.cus.hotel'/*非TMC酒店*/), offlineHotel, this.toEditRecord, this.deleteTravel,this.stopAndStart,startDate,isChangeVersion)}
              { travelUtil.getTravelRecord(messages('request.key410'/*火车*/), train, this.toEditRecord, this.deleteTravel,'',this.stopAndStart,startDate,isChangeVersion)}
              { travelUtil.getDiDiRecord(messages('request.key590')/*用车*/,
                didi,
                startDate,
                this.deleteTravel,
                this.toEditRecord,
                this.stopAndStart,
                isChangeVersion,
                mapInfo
              )}
              { travelUtil.getDiningRecord(messages('request.key626')/*用餐*/,
                dining,
                startDate,
                this.deleteTravel,
                this.toEditRecord,
                this.stopAndStart,
                isChangeVersion
              )}
              { false && travelUtil.getSubsidyRecord(messages('request.key413'/*差补*/),
                subsidy,
                this.toEditRecord,
                this.deleteTravel,
                this.displayDetail,
                this.toBatchChange,
                this.amountChange,
                this.toSaveChange,
                this.toEditSubsidyItem,
                this.searchByDate,
                this.isHiddenItem,
                this.isCancelHiddenItem,
                subCtrlObj
              )}
              { false && travelUtil.getRemarkRecord(messages('request.key411'/*备注*/), remark, this.toEditRecord, this.deleteTravel, this.clearRowRemark,startDate)}
              { false && travelUtil.getTravelRecord(messages('request.key412'/*其他*/),
                other,
                this.toEditRecord,
                this.deleteTravel,
                this.updateTravel,
                this.stopAndStart,
                startDate,
                isChangeVersion)}
              { travelUtil.getOtherRecord(messages('request.key412'/*其他*/),
                otherItinerarys,
                this.toEditRecord,
                this.deleteTravel,
                this.updateTravel,
                this.displayDetail,
                this.toBatchChange,
                this.amountChange,
                this.toSaveChange,
                this.toEditSubsidyItem,
                this.searchByDate,
                this.isHiddenItem,
                this.isCancelHiddenItem,
                subCtrlObj,
                baseCcy)}
            </Collapse>
          </Col>
        </Row>}
        {
          mapInfo['ca.travel.flight.disabled'] !== 'true'
          && <SlideFrame title={messages('request.key322'/*添加TMC机票行程*/)}
                         content={TravelPlane}
                         show={isShowPlaneSlide}
                         onClose={this.setClose}
                         params={setInfo}
                         afterClose={(pra)=>this.afterBaseCloseSlide(pra,'plane')}/>
        }
        {
          mapInfo['ca.travel.train.disabled'] !== 'true'
          && <SlideFrame title={messages('request.key323'/*火车行程*/)}
                         content={TravelTrain}
                         show={isShowTrainSlide}
                         onClose={this.setClose}
                         params={setInfo}
                         afterClose={(pra)=>this.afterBaseCloseSlide(pra,'train')}/>
        }
        {
          <SlideFrame title={messages('request.key600')/*用车行程*/}
                         content={TravelDiDi}
                         show={isShowDiDiSlide}
                         onClose={this.setClose}
                         params={Object.assign({isShowDiDiSlide}, setInfo)}
                         afterClose={(pra)=>this.afterBaseCloseSlide(pra,'didi')}/>
        }
        {
          mapInfo['dining.itinerary.enable'] === 'true' && (
            <SlideFrame
              title={messages('request.key626')/*用餐*/}
              content={TravelDining}
              show={isShowDiningSlide}
              onClose={this.setClose}
              params={setInfo}
              afterClose={(pra) => this.afterBaseCloseSlide(pra, 'dining')}
            />
          )
        }
        {
          mapInfo['travel.allowance.disabled'] !== 'true'
          && <SlideFrame title={isShowTip ? <span>{messages('request.key425'/*添加差补*/)}<Icon className="subsidy-tip-icon" onClick={this.showSubsidyTip} type="info-circle-o"/></span> : messages('request.key425'/*添加差补*/)}
                         content={TravelSubsidy}
                         show={isShowSubsidySlide}
                         params={setInfo}
                         onClose={this.setClose}
                         afterClose={(pra)=>this.afterBaseCloseSlide(pra,'subsidy')}/>
        }

        {
          mapInfo['hotel.itinerary.enable'] === "true"
          && <SlideFrame title={messages('request.key426'/*添加TMC酒店*/)}
                         content={TravelHotel}
                         show={isShowHotelSlide}
                         onClose={this.setClose}
                         params={setInfo}
                         afterClose={(pra)=>this.afterBaseCloseSlide(pra,'hotel')}/>
        }

        {
          mapInfo['offline.hotel.itinerary.enable'] === "true"
          && <SlideFrame title={messages('mcd.custom.hotel'/*添加非TMC酒店*/)}
                         content={TravelCusHotel}
                         show={isShowCusHotelSlide}
                         onClose={this.setClose}
                         params={setInfo}
                         afterClose={(pra)=>this.afterBaseCloseSlide(pra,'offlinehotel')}/>
        }

        {
          mapInfo['airline.itinerary.enable'] === "true"
          && <SlideFrame title={messages('mcd.cus.add.flight'/*添加非TMC机票*/)}
                         content={TravelAirline}
                         show={isShowAirlineSlide}
                         onClose={this.setClose}
                         params={setInfo}
                         afterClose={(pra)=>this.afterBaseCloseSlide(pra,'airline')}/>
        }
        {
          mapInfo['urban.itinerary.enable'] === "true"
          && <SlideFrame title={messages('mcd.cus.add.city.traffic'/*添加市内交通*/)}
                         content={TravelUrban}
                         show={isShowUrbanSlide}
                         onClose={this.setClose}
                         params={setInfo}
                         afterClose={(pra)=>this.afterBaseCloseSlide(pra,'urban')}/>
        }
        {
          mapInfo['water.itinerary.enable'] === "true"
          && <SlideFrame title={messages('mcd.cus.add.amphibious'/*添加水陆客运*/)}
                         content={TravelWater}
                         show={isShowWaterSlide}
                         onClose={this.setClose}
                         params={setInfo}
                         afterClose={(pra)=>this.afterBaseCloseSlide(pra,'water')}/>
        }

        <SlideFrame title={messages('request.key583')/*外部行程*/}
                    content={TravelOut}
                    show={isShowOutSlide}
                    onClose={this.setClose}
                    params={setInfo}
                    afterClose={(pra) => this.afterBaseCloseSlide(pra, 'out')}/>

        {
          mapInfo['ca.travel.remark.disabled'] !== 'true'
          && <SlideFrame title={messages('request.key427'/*添加备注*/)}
                         content={TravelRemark}
                         show={isShowRemarkSlide}
                         onClose={this.setClose}
                         params={setInfo}
                         afterClose={(pra)=>this.afterBaseCloseSlide(pra,'remark')}/>
        }

        {
          mapInfo['ca.travel.other.disabled'] !== 'true'
          && <SlideFrame title={messages('request.key324'/*其他行程*/)}
                         content={TravelOther}
                         show={isShowOtherSlide}
                         onClose={this.setClose}
                         params={setInfo}
                         afterClose={(pra)=>this.afterBaseCloseSlide(pra,'other')}/>
        }

        {
          (formCode === 'MCD1001' || formCode === 'MCD4001') && url &&
          (mapInfo['hotel.itinerary.enable'] === "true" || mapInfo['ca.travel.flight.disabled'] !== 'true')
          && <SlideFrame
            show={showConsumptionFrame}
            content={BookConsumptionFrame}
            hasFooter={false}
            hasPadding={false}
            hasMask={false}
            params={{
              url: zhenxuanUrl
            }}
            onClose={()=>this.handleCloseExpense()}
            cusClass={'zx-frame'}
            width="calc(100vw - 206px)"
            // height="calc(100vh - 64px)"
            // top="64px"
          />
        }

        <div className="type-fotter"></div>
        <Modal title={messages('request.key428'/*编辑差补*/)}
               visible={subCtrlObj.isEditSubsidyItem}
               onOk={this.toSaveChange}
               onCancel={this.cancelEditSubsidyModal}
               okText={messages('request.key211'/*确定*/)}
               cancelText={messages('request.key175'/*取消*/)}
               getContainer={() => document.getElementsByClassName('type-fotter')[0]}
               width={'50%'}
        >
          <Spin spinning={subCtrlObj.isSaveChange}>
            <Form>
              <Row style={{marginBottom:24}}>
                <Col className="subsidy-modal-update" span={4}>{messages('request.key429'/*日期*/)}:</Col>
                <Col span={8}><DatePicker disabled={true} value={subsidyItem.subsidiesDate ? moment(subsidyItem.subsidiesDate) : moment(new Date())} style={{width: '100%'}}/></Col>
                <Col className="subsidy-modal-update" span={4}>{messages('request.key430'/*城市*/)}:</Col>
                <Col span={8}>{subsidyItem.city ? subsidyItem.city : (<span style={{color: '#d4d4d4'}}>{messages('request.key555')/*通用城市*/}</span>)}</Col>
              </Row>
              <Row style={{marginBottom:24}}>
                <Col className="subsidy-modal-update" span={4}>{messages('request.key431'/*类型*/)}:</Col>
                <Col span={18}>{subsidyItem.expenseTypeName}</Col>
              </Row>
              <Row>
                <Col span={12}>
                  {
                    <FormItem {...formItemLayoutS} label={`${messages('request.key432'/*金额*/)}(${subsidyItem.currencyCode})`}>
                      {getFieldDecorator('amount',this.cfo(messages('request.key432'/*金额*/),{type:'number',value:subsidyItem.amount},false))(
                         <InputNumber precision={queryCurrencyPrecision(subsidyItem.currencyCode)} disabled={amountProfile>1001?false:true} min={0} />
                      )}
                    </FormItem>
                  }
                </Col>
                <Col span={12}>
                  <FormItem {...formItemLayoutS} label={messages('request.key433'/*原金额*/)}>
                    {getFieldDecorator('baseAmount',this.cfo(messages('request.key433'/*原金额*/),{type:'number',value:subsidyItem.baseAmount},false))(
                      <InputNumber precision={queryCurrencyPrecision(subsidyItem.currencyCode)} disabled={true}/>
                    )}
                  </FormItem>
                </Col>
              </Row>
              {
                <FormItem {...formItemLayoutM2} label={messages('request.key434'/*汇率*/)}>
                  {getFieldDecorator('currencyRate',{
                    rules: [{
                      required: true,
                      message: messages('request.key435'/*汇率须为大于零数字*/)
                    }],
                    initialValue:subsidyItem.currencyRate
                  })(
                      <Input type="number" disabled={!(!isCanChangeRate && subsidyItem.currencyCode!='CNY')} style={{width: '100%'}} min={0} onChange={this.currencyRateChange}/>
                  )}
                  {
                    !isCanChangeRate && subsidyItem.currencyCode!='CNY' && <span>
                        {` ${subsidyItem.baseCurrencyRate}
                        ${(subsidyItem.currencyRate - subsidyItem.baseCurrencyRate) < 0 ? ' - ' : ' + '}
                        ${(Math.abs(subsidyItem.currencyRate - subsidyItem.baseCurrencyRate) / subsidyItem.baseCurrencyRate * 100).toFixed(1)}%`}
                      </span>
                  }
                </FormItem>
              }
              <FormItem {...formItemLayoutL} label={messages('request.key436'/*备注*/)}>
                {getFieldDecorator('comment',this.cfo(messages('request.key436'/*备注*/),{type:'str',value:subsidyItem.comment,maxNum:100},true))(
                  <TextArea placeholder={messages('request.key437'/*非必填,最多100个字符*/)}
                            autosize={{minRows: 3, maxRows: 6}}
                            maxLength="101"/>
                )}
              </FormItem>
            </Form>
          </Spin>
        </Modal>
        <Modal
          title={messages('request.key614')/*自动生成差补*/}
          visible={autoSubsidyVisible}
          onCancel={this.closeAutoSubsidyModal}
          maskClosable={false}
          closable={false}
          destroyOnClose
          footer={[
            <Button key="submit" type="primary" onClick={this.hideSubsidyModal}>{messages('common.ok')/*确定*/}</Button>
          ]}
        >
          <div>{messages('request.key615')/*根据公司政策，系统已自动为您生成“差旅餐饮/洗衣费”明细！*/}</div>
        </Modal>
      </div>
    )
  }
}


function mapStateToProps(state) {
  return {
    user: state.login.user,
    company: state.login.company
  };
}
const wrappedTravelType = Form.create()(TravelType);
export default connect(mapStateToProps)(wrappedTravelType);
